<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class client extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('xmlrpc');
        $server_url = site_url('service');
        $this->xmlrpc->server($server_url, 80);
    }

    function login() {
        $this->xmlrpc->method('login');
        $request = array('admin', 'admin');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
    
     function logindokter() {
        $this->xmlrpc->method('logindokter');
        $request = array('adi', '1');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }

    function penyakit() {
        $this->xmlrpc->method('get_penyakit');
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }

    function gejala() {
        $this->xmlrpc->method('get_gejala');
        $request = array();
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
    
      function bobotgejala() {
        $this->xmlrpc->method('bobotgejala');
        $request = array();
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
    
     function getallpenyakit() {
        $this->xmlrpc->method('getallpenyakit');
        $request = array();
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
    
    function get_penyakit($id_gejala, $jenis) {
        $this->xmlrpc->method('get_penyakitwhereidgejala');
        $request = array($id_gejala, $jenis);
        $this->xmlrpc->request($request);
      //  $this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
    
     function get_user($username) {
        $this->xmlrpc->method('get_user');
        $request = array($username);
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
    
     function get_id_pemilik($nama) {
        $this->xmlrpc->method('get_id_pemilik');
        $request = array($nama);
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
    

    function tambahpemilik() {
        $this->xmlrpc->method('tambahpemilik');
        $request = array('diah', 'jakal', '08789');
        $this->xmlrpc->request($request);
        // $this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }
    
     function tambahperiksa() {
        $this->xmlrpc->method('tambahperiksa');
        $request = array('1', '23', '1', '3', '40');
        $this->xmlrpc->request($request);
         $this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }
    
    function tambahhewan() {
        $this->xmlrpc->method('tambahhewan');
        $request = array('1', '1', '30', '200');
        $this->xmlrpc->request($request);
        // $this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }

}
